#ifndef _APP_FLASH_
#define _APP_FLASH_
#include "MX25_CMD.h"

#define PAGE_TO_ADDR(x)    (x * 256)
#define SECTOR_TO_ADDR(x)  (x * 4096)
#define BLOCK_TO_ADDR(x)   (x * 65536)

#define PAGE(x)     (x)
#define SECTOR(x)   (x)
#define BLOCK(x)    (x)

ReturnMsg erase_page_then_write(uint32 flash_address, uint8 *source_address, uint32 byte_length);
uint32 write_data_continuous(const uint32 flash_address, uint8 *source_address, const uint32 byte_length);
ReturnMsg flash_read_page(uint32 flash_address, uint8 *target_address, uint32 byte_length);
ReturnMsg flash_erase_sector(uint32 flash_address);
ReturnMsg flash_erase_block(uint32 flash_address);

#endif
